# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=perl-libapreq2
_pkgreal=libapreq2
pkgver=2.17
pkgrel=2
pkgdesc="Perl module for libapreq2"
url="https://metacpan.org/release/libapreq2/"
arch="all"
license="GPL PerlArtistic"
depends="apache2 perl"
subpackages="$pkgname-dev $pkgname-doc"
install="$pkgname.post-install"
makedepends="perl-extutils-xsbuilder perl-dev libtool apache2-dev apache2-mod-perl-dev expat-dev apr-util-dev"
source="https://dlcdn.apache.org//httpd/libapreq/libapreq2-$pkgver.tar.gz
	libapreq2-2.08-doc.patch
	link-in-apr-shared-objects.patch
	$pkgname.conf"

builddir="$srcdir/$_pkgreal-$pkgver"

build() {
	PERL_MM_USE_DEFAULT=1 perl Makefile.PL \
		--with-apache2-apxs=/usr/bin/apxs \
		--with-apache2-httpd=/usr/sbin/httpd
	make LD_RUN_PATH="/usr/lib"
}

package() {
	make DESTDIR="$pkgdir" INSTALLDIRS="vendor" install
	install -Dm644 "$srcdir"/$pkgname.conf \
		"$pkgdir"/etc/apache2/conf.d/perl-libapreq2.conf
	find "$pkgdir" -name mod_apreq2.la -delete
	find "$pkgdir" -name libapreq2.la -delete
}

sha512sums="
89b139b8673145d9e2d8fd77d36f878c519c1deb7f9b853cda2a15d34cbb619d1c5e784ba21553f23c2ef07803f07c75a83d96cd770f80e1b36283a4cbb88999  libapreq2-2.17.tar.gz
dc889d7890d9059efdb3fcd4d6b1e485929b69c073ff6266b90f82e89efe5bdd633fd4dc09ccd4aac3f8816271c00dca69b39ffe4706baf7d3094404784cd766  libapreq2-2.08-doc.patch
04b41c1e0694f53c5164e92c6cd81236f8030a265d9af4f5160c051425c9fa75c6326728734c31fc3f61baa88ae40924ef78974bd3cd2af719cb3bb9bb9428d3  link-in-apr-shared-objects.patch
e7fa4f3b51cbc6417369ba171ac0fb955ec0cd6d3575e07e7451ef2a8165d24ddbbcc3143a5c8106a757ecd7d4286a11a9ff87e27c1acff8abc48110fcb02e1f  perl-libapreq2.conf
"
